We all know that when a large volume of data is inserted into MySQL,MySQL uses load data local infile to import data from a file faster than the insert Statement, which is about 20 times faster.However, this method has a disadvantage: before
I want to execute MySQL's load data local infile statement in a PHP script, I use the PDO link database, the data does not write, how to use, solve
Reply content:
I want to execute MySQL's load data local infile statement in a PHP script, I use
About mysql load data local infile support Question 1. run The following command: ERROR 1148 (42000): The used command is not allowed with this MySQL version. Solution: first go to MYSQL and check that version: 5.1 or later is supported. Mysql>
To support the command load data local infile, add the following settings in/etc/MySQL/My. CNF:
[Mysqld] # server configuration local-Infle = 1 [MySQL] # client configuration local-infile = 1Otherwise, the MySQL service will prompt an error:
Error
Mysql LoadData the Use in the database, the most common way to write data is through Sqlinsert to write, and the other is to restore the database through backup files, this backup file in MySQL is SQL script, actually executed in BULK INSERT
Java uses mysql load data local infile to import DATA in large batches to MySQL, mysqlinfile
Use of Mysql load data
In a database, the most common way to write data is to write data through SQL insert, and recover the database through backup files.
Today, between the two MySQL servers to guide the data, because another MySQL server is testing, one months of data, from the existing MySQL server Select to a file, the specific statement is:* FROM news where Ine_time>="/tmp/newsdata.sql"; Then
Usage of mysqlloaddatainfile (importing 40 W data to mysql in 3-5 seconds) bitsCN.com
If you want to import Chinese data, the utf8 character set in mysql will save the UTF-8 character set for the xxx.txt file you want to import. the command load
If you want to import Chinese data, the utf8 Character Set set in mysql will save the UTF-8 character set for the xxx.txt file you want to import. The command load data infile "d: /Websites/Sxxxx/test1.txt "ignore into table 'names' fields
No error code is returned when importing csv files from a local wamp: Repeated replace=tablenewcardcharactersetutf8fieldsterminatedbyenclosedbylinesterminatedbyrn ('code ')
No error code is returned when importing csv files from the local wamp: load
If you are importing the Chinese data, my MySQL set UTF8 character set, so you want to import the Xxx.txt file to save the Utf-8 character set, command load Data infile "D:/websites/sxxxx/test1.txt" Ignore into table ' names ' fields terminated by ',
MySQL is installed in two parts: client and server. After the MySQL server and client are installed, the database tables and the table structures in the database are imported and exported, some SQL commands used now:
> MySQL-u busiusr-p enters the
Mysqlload primary key verification load data LOCAL infile '~ /Documents/load_test.txt 'into TABLE test fields terminated by', 'enabledby '"'lines TERMINATED by'/N ';
1. if the id is not the primary key, it will not stop increasing.
Mysql> load
As the platform of data management, the security of the database is determined by the internal security and network security of the system first. For system administrators, the first thing to ensure the security of the system itself, when installing
Mysql common command lines
Mysql common command lines
First, start and stop the mysql Service
Net stop mysql
Net start mysql
Second, log on to mysql
Syntax: mysql-u user name-p User Password
Enter the mysql-uroot-p command, press enter and prompt
Apache: 1. Modify the banner compilation source code and modify the default banner ServerTokens ProductOnly ServerSignature Off.Find ap_release.h in the apache source code package and change # define AP_SERVER_BASEPRODUCT "Apache" to # define
First, start and stop the MySQL Service
Net stop MySQL
Net start MySQL
Second, log on to MySQL
Syntax: mysql-u user name-P User Password
Enter the mysql-uroot-p command, press enter and prompt you to enter the password, enter 12345, and
First, start and stop the MySQL Service
Net stop MySQL
Net start MySQL
Second, log on to MySQL
Syntax: mysql-u user name-P User Password
Enter the mysql-uroot-p command, press enter and prompt you to enter the password, enter 12345, and then press
Basic syntax:
Load data [low_priority] [local] infile ' file_name txt ' [replace | ignore]into table Tbl_name[Fields[Terminated by ' t '][optionally] enclosed by '][escaped by ']][Lines terminated by ' n '][Ignore number lines][(Col_name,)]The load
1. Modify the root user password to remove the empty passwordThe default installed MySQL root user is a blank password, for security purposes, must be modified as a strong password, so-called strong password, at least 8 bits, composed of letters,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.